<script type="text/javascript">
	function cancel() {
        window.location = '<?php echo base_url();?>setup/ga_warehouse';
    }
	function save(warehouse_id) {
        $.post("<?= site_url() ?>setup/update_item", {
			warehouse_id: warehouse_id, 
			item: $('#item').val(),
			qty: $('#qty').val(),
			qty_active: $('#qty_active').val(),
			qty_not_active: $('#qty_not_active').val(),
			status: $('#status').val() 
		}, 
		function(data) {
            window.location = '<?php echo base_url();?>setup/ga_warehouse';
        });
    }
</script>

<form method="post" id="formuser" action="#" enctype="multipart/form-data" class="form-horizontal" role="form">
	<div class="col-md-offset-1">
		<div class="col-md-11">
			<div class="panel-body well">
				<h4><b class="caret"></b><b> Form - Edit Warehouse Item</b></h4>
				<div class="col-sm-8">
					<div class="col-sm-5"><label for="item_name" class="control-label">Item Name<span style="color:red;">*</span></label></div>
					<div class="col-sm-4"><input type="text" class="form-control input-sm required" id="item" name="item" value="<?php echo $detail_item['WAREHOUSE_ITEM_NAME'] ?>"></div>
				</div>
				<div class="col-sm-8">
					<div class="col-sm-5"><label for="item_qty" class="control-label">Item Qty<span style="color:red;">*</span></label></div>
					<div class="col-sm-4"><input type="text" class="form-control input-sm required" id="qty" name="qty" value="<?php echo $detail_item['WAREHOUSE_ITEM_QTY'] ?>" align="right"></div>
				</div>
				<div class="col-sm-8">
					<div class="col-sm-5"><label for="item_qty_a" class="control-label">Item Qty Active<span style="color:red;">*</span></label></div>
					<div class="col-sm-4"><input type="text" class="form-control input-sm required" id="qty_active" name="qty_active" value="<?php echo $detail_item['WAREHOUSE_ITEM_ACTIVE'] ?>" align="right"></div>
				</div>
				<div class="col-sm-8">
					<div class="col-sm-5"><label for="item_qty_n" class="control-label">Item Qty Not Active<span style="color:red;">*</span></label></div>
					<div class="col-sm-4"><input type="text" class="form-control input-sm required" id="qty_not_active" name="qty_not_active" value="<?php echo $detail_item['WAREHOUSE_ITEM_NOT_ACTIVE'] ?>" align="right"></div>
				</div>
				<div class="col-sm-8">
					<div class="col-sm-5"><label for="l_status" class="control-label">Item Status<span style="color:red;">*</span></label></div>
					<div class="col-sm-3">
						<select name="status" id="status" class="form-control input-sm required">
							<option value="Y"<?php echo (strtoupper($detail_item['WAREHOUSE_ITEM_STATUS']) == 'Y') ? 'selected' : ''; ?>>Active</option>
                            <option value="N"<?php echo (strtoupper($detail_item['WAREHOUSE_ITEM_STATUS']) != 'Y') ? 'selected' : ''; ?>>Non Active</option>
						</select>
					</div>
				</div>
				<div class="col-sm-8" style="padding-bottom: 10px;">
					<div class="col-sm-4">
						&nbsp;
					</div>
				</div>
				<div class="col-sm-8">
					<div class="col-sm-4"><label for="button" class="control-label">&nbsp;</label></div>
					<div class="col-sm-4">
						<button type="button" class="btn btn-success btn-block" onclick="save('<?php echo $warehouse_id ?>');">
						<!--span class="glyphicon glyphicon-saved"></span--> Save Edit</button>
					</div>
					<div class="col-sm-4">
						<button type="button" class="btn btn-default btn-block" onclick="cancel();">
						<!--span class="glyphicon glyphicon-circle-arrow-left"></span--> Cancel</button>
					</div>
				</div>
			</div>
		</div>
	</div>
</form>